﻿@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <!-- Tell the browser to be responsive to screen width -->
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
    <!-- Favicon icon -->
    <link rel="icon" type="image/png" sizes="16x16" href="~/res/assets/images/favicon.png">
    <title>周游库存管理平台</title>
    <!-- Bootstrap Core CSS -->
    <link href="~/res/assets/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <!-- Custom CSS -->
    <link href="~/res/css/style.css" rel="stylesheet" />
    <!-- You can change the theme colors from here -->
    <link href="~/res/css/colors/blue.css" id="theme" rel="stylesheet" />
</head>
<body class="fix-header fix-sidebar card-no-border">
    <div id="demo">
        <!-- ============================================================== -->
        <!-- Preloader - style you can find in spinners.css -->
        <!-- ============================================================== -->
        <div class="preloader">
            <svg class="circular" viewBox="25 25 50 50">
                <circle class="path" cx="50" cy="50" r="20" fill="none" stroke-width="2" stroke-miterlimit="10" />
            </svg>
        </div>
        <!-- ============================================================== -->
        <!-- Main wrapper - style you can find in pages.scss -->
        <!-- ============================================================== -->
        <div id="main-wrapper">
            <!-- ============================================================== -->
            <!-- Topbar header - style you can find in pages.scss -->
            <!-- ============================================================== -->
            <header class="topbar">
                <nav class="navbar top-navbar navbar-expand-md navbar-light">
                    <!-- ============================================================== -->
                    <!-- Logo -->
                    <!-- ============================================================== -->
                    <div class="navbar-header">
                        <a class="navbar-brand">
                            <!-- Logo icon --><b>
                                <!--You can put here icon as well // <i class="wi wi-sunset"></i> //-->
                                <!-- Dark Logo icon -->
                                <img src="~/res/assets/images/logo-icon.png" alt="homepage" class="dark-logo" />
                                <!-- Light Logo icon -->
                                <img src="~/res/assets/images/logo-light-icon.png" alt="homepage" class="light-logo" />
                            </b>
                            <!--End Logo icon -->
                            <!-- Logo text --><span>
                                <!-- dark Logo text -->
                                <img src="~/res/assets/images/logo-text.png" alt="homepage" class="dark-logo" />
                                <!-- Light Logo text -->
                                <img src="~/res/assets/images/logo-light-text.png" class="light-logo" alt="homepage" />
                            </span>
                        </a>
                    </div>
                    <!-- ============================================================== -->
                    <!-- End Logo -->
                    <!-- ============================================================== -->
                    <div class="navbar-collapse">
                        <!-- ============================================================== -->
                        <!-- toggle and nav items -->
                        <!-- ============================================================== -->
                        <ul class="navbar-nav mr-auto mt-md-0">
                            <!-- This is  -->
                            <li class="nav-item"> <a class="nav-link nav-toggler hidden-md-up text-muted waves-effect waves-dark" href="javascript:void(0)"><i class="mdi mdi-menu"></i></a> </li>


                            <!-- Messages -->
                            <!-- ============================================================== -->
                          
                            <!-- ============================================================== -->
                            <!-- End Messages -->
                            <!-- ============================================================== -->
                        </ul>
                        <!-- ============================================================== -->
                        <!-- User profile and search -->
                        <!-- ============================================================== -->
                        <ul class="navbar-nav my-lg-0">
                            <!--<li class="nav-item dropdown">
                                <a class="nav-link dropdown-toggle text-muted waves-effect waves-dark" href="" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <i class="flag-icon flag-icon-us"></i></a>
                                <div class="dropdown-menu dropdown-menu-right scale-up">
                                <a class="dropdown-item" href="#"><i class="flag-icon flag-icon-in"></i> India</a>
                                <a class="dropdown-item" href="#"><i class="flag-icon flag-icon-fr"></i> French</a>
                                <a class="dropdown-item" href="#"><i class="flag-icon flag-icon-cn"></i> China</a>
                                <a class="dropdown-item" href="#"><i class="flag-icon flag-icon-de"></i> Dutch</a>
                                </div>
                            </li>-->
                        </ul>
                    </div>
                </nav>
            </header>
            <!-- ============================================================== -->
            <!-- End Topbar header -->
            <!-- ============================================================== -->
            <!-- ============================================================== -->
            <!-- Page wrapper  -->
            <!-- ============================================================== -->
            <div class="page-wrapper" style="margin-left:0">
                <!-- ============================================================== -->
                <!-- Container fluid  -->
                <!-- ============================================================== -->
                <div class="container-fluid" style="padding-top:25px">


                    <div class="row">
                        <div class="col-md-12">
                            <div class="alert alert-info ">
                                <span style="font-weight:bold">企业列表</span>
                                <button class="btn btn-outline-info waves-effect waves-light" type="button" style="margin-left:20px" v-on:click="OpenMode()"><span class="btn-label"><i class="fa fa-plus"></i></span>创建新企业</button>
                            </div>
                        </div>

                        <div class="col-md-4" v-for="x in List">
                            <div class="card">
                                <div class="card-body">
                                    <h4 class="card-title">
                                        {{x.TBE_NAME}}
                                    </h4>
                                    <ul class="nav nav-tabs" role="tablist">
                                        <li class="nav-item"> <a class="nav-link active" data-toggle="tab" :href='"#home" + x.TBE_DID' role="tab"><span><i class="ti-home"></i></span></a> </li>
                                        <li class="nav-item"> <a class="nav-link" data-toggle="tab" :href='"#profile" + x.TBE_DID' role="tab"><span><i class="ti-user"></i></span></a> </li>
                                    </ul>
                                    <div class="tab-content tabcontent-border">
                                        <div class="tab-pane active" :id='"home"+x.TBE_DID' role="tabpanel">
                                            <div class="p-20">
                                                <p>{{x.TBE_REMARK}}</p>
                                                <button class="btn btn-info waves-effect waves-light" type="button" v-on:click="InEnter(x)">
                                                    <span class="btn-label"><i class="fa fa-chevron-circle-right"></i></span>进入企业
                                                </button>
                                            </div>
                                        </div>
                                        <div class="tab-pane  p-20" :id='"profile"+x.TBE_DID' role="tabpanel">
                                            <h4>{{x.All_USER}}</h4>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>

                    </div>






                </div>
                <!-- ============================================================== -->
                <!-- End Container fluid  -->
                <!-- ============================================================== -->
            </div>
            <!-- ============================================================== -->
            <!-- End Page wrapper  -->
            <!-- ============================================================== -->
        </div>
        <!-- ============================================================== -->
        <!-- End Wrapper -->
        <!-- ============================================================== -->
        <!-- ============================================================== -->
        <!-- All Jquery -->
        <!-- ============================================================== -->


        <div id="EnModal" class="modal fade in" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                        <h4 class="modal-title" id="myModalLabel">创建企业</h4>
                    </div>
                    <div class="modal-body">
                        <from class="form-horizontal form-material">
                            <div class="form-group">
                                <div class="col-md-12 m-b-20">
                                    <input type="text" class="form-control" v-model="GridData.TBE_NAME" placeholder="企业名称">
                                </div>
                                <div class="col-md-12 m-b-20">
                                    <textarea rows="5" class="form-control" v-model="GridData.TBE_REMARK" placeholder="企业描述">
                                    </textarea>
                                </div>
                            </div>
                        </from>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn waves-effect waves-light btn-primary btn-info" v-on:click="saveData">创建</button>
                        <button type="button" class="btn waves-effect waves-light btn-default" data-dismiss="modal">关闭</button>
                    </div>
                </div>
            </div>
        </div>


    </div>


    <script src="~/res/assets/plugins/jquery/jquery.min.js"></script>
    <!-- Bootstrap tether Core JavaScript -->
    <script src="~/res/assets/plugins/bootstrap/js/popper.min.js"></script>
    <script src="~/res/assets/plugins/bootstrap/js/bootstrap.min.js"></script>
    <!-- slimscrollbar scrollbar JavaScript -->
    <script src="~/res/js/jquery.slimscroll.js"></script>
    <!--Wave Effects -->
    <script src="~/res/js/waves.js"></script>
    <!--Menu sidebar -->
    <script src="~/res/js/sidebarmenu.js"></script>
    <!--stickey kit -->
    <script src="~/res/assets/plugins/sticky-kit-master/dist/sticky-kit.min.js"></script>
    <script src="~/res/assets/plugins/sparkline/jquery.sparkline.min.js"></script>
    <!--Custom JavaScript -->
    <script src="~/res/js/custom.min.js"></script>
    <script src="~/res/assets/plugins/styleswitcher/jQuery.style.switcher.js"></script>
    <script src="~/res/js/jquery.cookie.js"></script>


</body>
</html>

<link href="~/res/assets/plugins/sweetalert/sweetalert.css" rel="stylesheet" type="text/css">
<script src="~/res/js/vue.min.js"></script>
<script src="~/res/assets/plugins/sweetalert/sweetalert.min.js"></script>
<script src="~/res/js/syscommon.js"></script>

<script type="text/javascript">
    var vm = new Vue({
        el: "#demo",
        data: {
            EntCon: "",
            UserName: "",
            UserPhone: "",
            Sort: "",
            List: [],
            LikeList: { TBU_NAME_LIKE: "", TBU_IPHONE_LIKE: "" },
            GridData: { TBE_NAME: "", TBE_REMARK: "" }
        },
        mounted: function () {
            this.Query();
            this.EntCon = GetCookie("EntUser", "TBE_NAME");
            this.UserName = GetCookie("user", "TBA_NAME");
            this.UserPhone = GetCookie("user", "TBA_IPHONE");
        },
        methods: {
            Query: function () {
                $(".preloader").fadeIn();//加载等待
                var _self = this;
                _self.List = [];
                $.post("../Essential/Enterprise?act=data&Sort=" + this.Sort, _self.LikeList,
                    function (data) {
                        data = JSON.parse(data);
                        for (var i = 0; i < data.data.length; i++) {
                            _self.List.push(data.data[i]);
                        }
                        $(".preloader").fadeOut();//取消加载等待
                    });
            },
            InEnter: function (moX) {
                $.post("../Essential/Enterprise?act=EntUser", {
                    TBU_DID: moX.TBU_DID,
                    TBE_DID: moX.TBE_DID,
                    TBE_NAME: moX.TBE_NAME
                },
                    function (data) {
                        data = JSON.parse(data);
                        if (data.status === 0) {
                            window.setTimeout(function () {
                                window.location.href = "../Essential/index";
                            }, 500);
                        } else {
                            swal("系统错误!", data.message);
                            return false;
                        }
                    });
            },
            OpenMode: function (moX) {
                this.GridData = Object.assign({}, moX);
                $('#EnModal').modal('toggle');
            },
            saveData: function () {
                $.post("../Essential/Enterprise?act=save", this.GridData,
                    function (data) {
                        data = JSON.parse(data);
                        if (data.status === 0) {
                            swal("操作成功!", "", "success");
                            vm.Query();
                        } else {
                            swal("系统错误!", data.message);
                        }
                    });
                $('#EnModal').modal('toggle');
            }
        }
    });

</script>



